<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>使用静态</title>
</head>
<body>
    <div id="houdunren">houdunren.com</div>
    <div name="hdcms">hdcms.com</div>
    
    <script>
        const nodes = document.getElementsByTagName('div');
        //如果要保存静态集合,需要对集合进行复制
        const clone = Array.prototype.slice.call(nodes,0);
        console.log(nodes.length);
        document.body.appendChild(document.createElement('div'));
        console.log(nodes.length);
        console.log(clone.length);
 </script>
</body>
</html>